<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>

<script>
    function ajax(time){
        return new Promise((resolve,reject)=>{
            setTimeout(()=>{
                resolve()
            },time)
        })
    }

    Promise.all([ajax(1000),ajax(4000),ajax(2000),ajax(5000)]).then(()=>{
        console.log('完成所有任务');
    })
    Promise.race([ajax(1000),ajax(4000),ajax(2000),ajax(5000)]).then(()=>{
        console.log('有一个已完成，剩余任务还为完成');
    })


</script>